package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.ZhwyTemporarydeposit;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ZhwyPaymentbillHouse;
import com.ruoyi.system.service.IZhwyPaymentbillHouseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 收费统计商铺1Controller
 * 
 * @author ruoyi
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/system/paymentbillhouse")
public class ZhwyPaymentbillHouseController extends BaseController
{
//
    @Autowired
    private IZhwyPaymentbillHouseService zhwyPaymentbillHouseService;


    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:list')")
    @GetMapping("/groupByShop")
//    111111111111111111
//
    public AjaxResult list(@RequestParam(name = "beginTime", required = false) String beginTime,
                           @RequestParam(name = "endTime", required = false) String endTime){

        List<ZhwyTemporarydeposit> SumGroupByShop = zhwyPaymentbillHouseService.getSumGroupByShop(beginTime, endTime);

        return AjaxResult.success(SumGroupByShop);
    }

    /**
     * 查询收费统计商铺1列表
     */
    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZhwyPaymentbillHouse zhwyPaymentbillHouse)
    {
        startPage();
        List<ZhwyPaymentbillHouse> list = zhwyPaymentbillHouseService.selectZhwyPaymentbillHouseList(zhwyPaymentbillHouse);
        return getDataTable(list);
    }

    /**
     * 导出收费统计商铺1列表
     */
    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:export')")
    @Log(title = "收费统计商铺1", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZhwyPaymentbillHouse zhwyPaymentbillHouse)
    {
        List<ZhwyPaymentbillHouse> list = zhwyPaymentbillHouseService.selectZhwyPaymentbillHouseList(zhwyPaymentbillHouse);
        ExcelUtil<ZhwyPaymentbillHouse> util = new ExcelUtil<ZhwyPaymentbillHouse>(ZhwyPaymentbillHouse.class);
        util.exportExcel(response, list, "收费统计商铺1数据");
    }

    /**
     * 获取收费统计商铺1详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(zhwyPaymentbillHouseService.selectZhwyPaymentbillHouseById(id));
    }

    /**
     * 新增收费统计商铺1
     */
    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:add')")
    @Log(title = "收费统计商铺1", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZhwyPaymentbillHouse zhwyPaymentbillHouse)
    {
        return toAjax(zhwyPaymentbillHouseService.insertZhwyPaymentbillHouse(zhwyPaymentbillHouse));
    }

    /**
     * 修改收费统计商铺1
     */
    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:edit')")
    @Log(title = "收费统计商铺1", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZhwyPaymentbillHouse zhwyPaymentbillHouse)
    {
        return toAjax(zhwyPaymentbillHouseService.updateZhwyPaymentbillHouse(zhwyPaymentbillHouse));
    }

    /**
     * 删除收费统计商铺1
     */
    @PreAuthorize("@ss.hasPermi('system:paymentbillhouse:remove')")
    @Log(title = "收费统计商铺1", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(zhwyPaymentbillHouseService.deleteZhwyPaymentbillHouseByIds(ids));
    }
}
